﻿<ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"         
        xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
        xmlns:Primitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone"
        mc:Ignorable="d">

        <Style TargetType="Button" x:Key="RectangleIconButtonStyle">
                <Setter Property="Width" Value="48"/>
                <Setter Property="Height" Value="48"/>
                <Setter Property="Margin" Value="0"/>
                <Setter Property="Padding" Value="0"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Background" Value="#FFCCCCCC"/>
                <Setter Property="Template">
                        <Setter.Value>
                                <ControlTemplate TargetType="Button">
                                        <Grid  Background="{TemplateBinding Property=Background}">
                                                <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                                <VisualState x:Name="Normal"/> 
                                                                <VisualState x:Name="Pressed">
                                                                        <Storyboard>
                                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="rectanglePressed">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                                                <DiscreteObjectKeyFrame.Value>
                                                                                                        <Visibility>Visible</Visibility>
                                                                                                </DiscreteObjectKeyFrame.Value>
                                                                                        </DiscreteObjectKeyFrame>
                                                                                </ObjectAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                </VisualState>
                                                        </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Grid Background="Transparent">
                                                        <Rectangle x:Name="rectanglePressed"  Fill="{StaticResource ResourceKey=PhoneAccentBrush}" Visibility="Collapsed"/>
                                                        <ContentPresenter Content="{TemplateBinding Property=Content}" ContentTemplate="{TemplateBinding Property=ContentTemplate}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                                                </Grid>
                                        </Grid>
                                </ControlTemplate>
                        </Setter.Value>
                </Setter>
        </Style>
</ResourceDictionary>
